refactor(jest-preset): to remove unhandled promise lockfile #1962
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Summary
This pull request suggests to remove the
fail-tests-because-there-was-an-unhandled-rejection.lock
file which is written when a unhandled promise rejection is detected by the Node.js process.Description
Jest can spawn various processes. This often made it hard to catch all unhandled promise rejections as some could originate in child processes and not communicate proper to the parent. As a result unhandled promise rejections might have gotten unnoticed when running a large test suite on machines with various cores.
The linked issue jestjs/jest#3251 (comment) discusses this at length.
However, in recent versions of Node.js unhandled promises will always immediately terminate the process. In addition in this jestjs/jest#4016 pull request the limitation causing the need for this, to my understanding, has been solved.
The resulting fix was available in Jest as of v21. The earliest visible blame on these lines in our preset are 3 year old. Before this was internal and existed. I suspect we just carried this forward but might not need it anymore.